<%@page language="java" isELIgnored="false" contentType="text/html"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix='fn' uri='http://java.sun.com/jsp/jstl/functions'%>

<div style="display: none;">
	<form method="post" action="" style="float: right;" >
			<input type="text" class="uiTextbox" id="txtSearch" size="30" name="query" value="${query }" />
			<input type="submit" class="uiButton" id="btnSearchSubmit" value="Search" />
	</form>
</div>
<div style="clear: both;"></div>
<div id="farmButtonStrip" class="buttonStrip">
	<div style="float:left;">
		<a id="btnAdd" class="uiButton" href="user?action=add">Add</a>
		<a id="btnEditUser" class="uiButton" href="user?action=edit">Edit</a>
		<a id="btnDeleteUser" class="uiButton" href="user?action=delete&item=user&pageNo=${navigationCurrentPage}">Delete</a>
	</div>
	<div style="float:right;">
		<%@ include file="/WEB-INF/views/navigation.jsp" %>
	</div>
	<div style="clear:both"></div>	
</div>
<div style="clear: both;">
		<div id="farmRecords" style="min-height: 400px;margin-top: 10px;">
			<table class="recordTable" width="100%" cellpadding="0" cellspacing="0">
				<thead>
					<tr>
						<th><input type="checkbox" id="cbxSelectAllItems" /></th>
						<th>Profile Picture</th>
						<th>FirstName</th>
						<th>LastName</th>
						<th>Gender</th>
						<th>Address</th>
						<th>Nationality</th>
						<th>UserName</th>
						<th>Status</th>
						<th>Responsibility</th>
					</tr>
				</thead>
				
				<tbody>
					<c:choose>
						<c:when test="${not empty userList  && fn:length(userList) > 0}">
							<c:forEach var="user" items="${userList }">
								<tr id="${user.id }">
											<td><input name="selectedUser" type="checkbox" value="${user.id }" id="${user.id }" />
											</td>
											<td>
												<div style="width: 60px; height: 60px; border: 1px solid #DDD; "><img alt="Person picture" src="user?item=pic&personid=${user.id }" id="userPicture" name="userPicture" height="50px;" width="50px;" /></div>
											</td>
											<td>${user.firstName}</td>
											<td>${user.lastName}</td>
											<td>${user.gender }</td>
											<td>
												Physical Address: ${user.addresses.physicalAddress }<br/>
												PhoneNo: ${user.addresses.phoneNo } <br/>
												Post Office code: ${user.addresses.postOfficeCode }<br/>
												Email : ${user.addresses.email }
											</td>
											<td>${user.nationality}</td>
											<td>${user.username}</td>
											<td>${user.status}</td>
											<td>${user.responsibility.name}</td>
										</tr>
							</c:forEach>
						</c:when>
					</c:choose>
				</tbody>
			</table>
		</div>
</div>